<?
/**
 * Copyright 2007 Melange.
 *
 * This file is part of PHP-MELANGE.
 *
 * PHP-MELANGE is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * PHP-MELANGE is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with PHP-MELANGE; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * @category    Melange
 * @package     php-melange
 * @subpackage  cms
 * @copyright   Copyright (c) 2007 Jeroen Simons. All rights reserved
 * @author      Jeroen Simons <jeroen@melange.nl>
 * @link        http://www.melange.nl/
 *
 */
?>
<?=$this->header()?>

    <?=$this->menu("login")?>

    <h1><?=$this->message("login.header", _Core::BUNDLE)?></h1>

    <? /* Breadcrums route & user info display */ ?>
    <?=$this->route($this->message("login.header", _Core::BUNDLE))?>

    <?
    /* Show error messages */
    if(!is_null($this->action) && $this->action->getPath() == "/failed") {
        require_once("mvc/action/ActionMessage.php");
        require_once("mvc/action/ActionMessages.php");
        $errors = new ActionMessages();
        $errors->add(ActionMessage::GLOBAL_MESSAGE, new ActionMessage("login.error.mismatch", true));
        $this->request->setAttribute(MVC::ERROR_KEY, $errors);
    }
    ?>
    <?=$this->errors(null, _Core::BUNDLE)?>

    <form id="loginForm" action="<?=$this->response->encodeURL("j_security_check")?>" method="post">

        <fieldset>

            <legend><?=$this->message("label.required", _Core::BUNDLE)?></legend>

            <table cellspacing="0" cellpadding="0" class="form">
            <tr class="ctrl<?=$this->error("j_username")?>">
                <th><label for="j_username"><?=$this->message("login.prompt.username", _Core::BUNDLE)?></label></th>
                <th class="required"><em>*</em></th>
                <td>
                    <input name="j_username"
                           id="j_username"
                           value=""
                           maxlength="32"
                           type="text"
                           class="textInput" />
                </td>
            </tr>
            <tr class="ctrl<?=$this->error("j_password")?>">
                <th><label for="j_password"><?=$this->message("login.prompt.password", _Core::BUNDLE)?></label></th>
                <th class="required"><em>*</em></th>
                <td>
                    <input name="j_password"
                           id="j_password"
                           value=""
                           maxlength="32"
                           type="password"
                           class="textInput" />
                </td>
            </tr>
            </table>

        </fieldset>

        <div class="buttons">

            <input type="submit"
                   value="<?=$this->message("button.submit", _Core::BUNDLE)?>"
                   class="button" />

        </div>

    </form>

    <?=$this->focus("loginForm", "j_username")?>

<?=$this->footer()?>